<%@ page pageEncoding='UTF-8'%>
<%@ taglib prefix="s" uri="/struts-tags" %>
<s:set var="contextPath" value="#request.get('javax.servlet.forward.context_path')" scope="request" />
<!DOCTYPE html>
<head>
    <title>Drug Registration</title>
    <%-- header --%>
    <jsp:include page="/WEB-INF/content/common/Header.jsp" flush="true"/>
    <script src="${contextPath}/js/jquery/jquery.validate.js"></script>
    <script src="${contextPath}/js/drug/drug.js"></script> 
    <script src="${contextPath}/js/jquery/additional-methods.min.js"></script> 
</head>
<body class="metro home">
	<%-- tob-bar --%>
    <jsp:include page="/WEB-INF/content/common/TopBar.jsp" flush="true"/>
       	
	<div id="main-container" class="body-wrapper">
        <%-- tob-container --%>
    	<jsp:include page="/WEB-INF/content/common/TopContainer.jsp" flush="true"/>
        
    	<div id="body-container">
        	<div id="drug-edit-form-container" class="form-container">
        		<%-- header-container --%>
                	<s:set var="mode" value="'registration'"/>
	   				<jsp:include page="/WEB-INF/content/drug/DrugMenuContainer.jsp" flush="true"/>

                <div class="form-banner-container place-left">
                	<img src="${contextPath}/img/page/drug/banner.jpg"/>
                </div>
                <div class="form-body-container place-right" style="width:65%">
	        		<form id="drug-registration-edit-form" class="registration-form registration-form" name="drug-registration-form" action="${contextPath}/drug/insert" method="post">
	                	<input type="hidden" name="guiDrug.drugId" value="${guiDrug.drugId}" />
	                	<fieldset>
	                		<legend>Drug Registration Form</legend>
                            
                            <div class="action-error-container">
                                <s:if test="hasActionErrors()">  
                                    <s:actionerror/>
                                </s:if>
                        	</div>
                            
	                        <label>Name<em class="text-alert">*</em></label>
	                        <div class="input-control text">
	                        	<input type="text" name="guiDrug.name" value="${guiDrug.name}" placeholder="insert drug name" required/>
	                            <button class="btn-clear"></button>
							</div>
							
	                        <label>Weight (mg)<em class="text-alert">*</em></label>
	                        <div class="input-control text">
	                        	<input type="text" name="guiDrug.weight" value="${guiDrug.weight}" placeholder="insert drug weight" required/>
	                            <button class="btn-clear"></button>
							</div>
							<label>Minimum<em class="text-alert">*</em></label>
	                        <div class="input-control text">
	                        	<input type="text" name="guiDrug.minimum" value="${guiDrug.minimum}" placeholder="insert minimum amount" required/>
	                            <button class="btn-clear"></button>
							</div>
	                        <label>Drug Brand<em class="text-alert">*</em></label>
							<div class="input-control select">							
								<s:select name="guiDrug.brand.brandId" value="%{guiDrug.brand.brandId}"
									list="%{guiDrugBrands}" listKey="brandId" listValue="name"
									headerKey="-1" headerValue="-- select a brand name --">
                                </s:select>								
							</div>
							<div>
								<a href="${contextPath}/drugbrand/registration">add drug brand</a>
								<br/><br/>
							</div>
	                        <div class="form-button-container">
								<a onClick="$('#drug-registration-edit-form').submit(); return false;">
		                        	<div class="form-button tile half-vertical subheader-secondary bg-cobalt fg-white">
				                        Insert <i class="icon-pencil on-right smaller"></i>
		                        	</div>
								</a>                            
								<a href="${contextPath}">
		                          	<div class="form-button tile half-vertical subheader-secondary bg-cyan fg-white">
		                            	Cancel <i class="icon-cancel-2 on-right smaller"></i>
		                           	</div>
								</a>
	                        </div>
	        			</fieldset>
	        		</form>
        		</div>
        		<br clear="all"/>
    		</div>    
    	</div>
        
        <%-- bottom-container --%>
    	<jsp:include page="/WEB-INF/content/common/BottomContainer.jsp" flush="true"/>
        
	</div>
    
    <%-- footer-container --%>
    <jsp:include page="/WEB-INF/content/common/FooterContainer.jsp" flush="true"/>
    
</body>
</html>